<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>practice</title>
    <script src="../js/lib/jquery-3.2.1.js"></script>

</head>
<body>


<h2 class="timespan"></h2>
<script>

    var starttime = new Date("2017/11/20");
    setInterval(function(){
        var nowtime = new Date();
        var time = starttime - nowtime;
        var day = parseInt(time / 1000 / 60 / 60 / 24);
        var hour = parseInt(time / 1000 / 60 / 60 % 24);
        var minute = parseInt(time / 1000 / 60 % 60);
        var seconds = parseInt(time / 1000 % 60);
        $('.timespan').html(day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒");
    }, 1000);
    var shopsArr;
    $.ajax({
        url : "../js/lib/tsconfig.json", success : function(shopsArr){
            var str = window.location.search;
            if(str.indexOf('?') != -1 && str.includes("=")){
                var arr = str.split("?")[1].split("=");
                console.log(arr[2]);
                $(".main_content .main_content_right>p:first-child").text(shopsArr[arr[2]].uName);
                $(".main_content .main_content_left>a>img").attr("src", shopsArr[arr[2]].uSrc);
                $(".main_content .main_content_left>.magnifying_small>img:nth-of-type(1)").attr("src", shopsArr[arr[2]].uSrc);
                $(".main_content .main_content_left .big_img").attr("src", shopsArr[arr[2]].uSrc);
                $(".main_content .content_price>span:first-child").text(shopsArr[arr[2]].newPrice);
                $(".main_content .content_price>span:nth-of-type(2)").text(shopsArr[arr[2]].oldPrice);
                $(".main_content .content_price>span:nth-of-type(3)").text(shopsArr[arr[2]].discount);
                $(".main_content_right>p:nth-of-type(3)>span:nth-of-type(2)").text(shopsArr[arr[2]].reduce)
            }
        }
    });


</script>
</body>
</html>